package Test;


import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import dao.SqlSessionFactoryUtil;
import dao.catDao;
import entity.Cat;
import entity.Shop;
import entity.User;

public class addCat {

	@Test
	public void addCat(){
		SqlSession se=null;
		
		try {
			se=SqlSessionFactoryUtil.getSqlSession();
			catDao dao=se.getMapper(catDao.class);
			Cat cat=new Cat();
			cat.setCatNumber(20);
			
			Shop shop=new Shop();
			shop.setShopId(2);
			cat.setShopId(shop);
			
			
			User user=new User();
			user.setUserId(2);
			cat.setUserId(user);
			
			int falg=dao.addCat(cat);
			System.out.println("falg====="+falg);
			se.commit();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			if(se!=null){
				se.close();
			}
			
		}
		
		
	}
	
}
